<!DOCTYPE html>
<html lang="zh">
<head>
  <meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=2">
<meta name="theme-color" content="#222">
<meta name="generator" content="Hexo 5.3.0">


  <link rel="apple-touch-icon" sizes="180x180" href="/yuwanzi.io/images/apple-touch-icon-next.png">
  <link rel="icon" type="image/png" sizes="32x32" href="/yuwanzi.io/images/favicon-32x32-next.png">
  <link rel="icon" type="image/png" sizes="16x16" href="/yuwanzi.io/images/favicon-16x16-next.png">
  <link rel="mask-icon" href="/yuwanzi.io/images/logo.svg" color="#222">

<link rel="stylesheet" href="/yuwanzi.io/css/main.css">



<link rel="stylesheet" href="//cdn.jsdelivr.net/npm/@fortawesome/fontawesome-free@5.15.1/css/all.min.css">
  <link rel="stylesheet" href="//cdn.jsdelivr.net/npm/animate.css@3.1.1/animate.min.css">

<script class="hexo-configurations">
    var NexT = window.NexT || {};
    var CONFIG = {"hostname":"suyuhuan.gitee.io","root":"/yuwanzi.io/","images":"/yuwanzi.io/images","scheme":"Muse","version":"8.2.0","exturl":false,"sidebar":{"position":"left","display":"post","padding":18,"offset":12},"copycode":false,"bookmark":{"enable":false,"color":"#222","save":"auto"},"fancybox":false,"mediumzoom":false,"lazyload":false,"pangu":false,"comments":{"style":"tabs","active":null,"storage":true,"lazyload":false,"nav":null},"motion":{"enable":true,"async":false,"transition":{"post_block":"fadeIn","post_header":"fadeInDown","post_body":"fadeInDown","coll_header":"fadeInLeft","sidebar":"fadeInUp"}},"prism":false,"i18n":{"placeholder":"Suche...","empty":"We didn't find any results for the search: ${query}","hits_time":"${hits} results found in ${time} ms","hits":"${hits} results found"}};
  </script>
<meta name="description" content="Skip List的工作原理 Skip List（跳跃表）是一种支持快速查找的数据结构，插入、查找和删除操作都仅仅只需要O(log n)对数级别的时间复杂度，它的效率甚至可以与红黑树等二叉平衡树相提并论，而且实现的难度要比红黑树简单多了。 Skip List主要思想是将链表与二分查找相结合，它维护了一个多层级的链表结构（用空间换取时间），可以把Skip List看作一个含有多个行的链表集合，每一行">
<meta property="og:type" content="article">
<meta property="og:title" content="SkipList的那点事儿">
<meta property="og:url" content="https://suyuhuan.gitee.io/yuwanzi.io/2017/12/31/2017-12-31-skip_list/index.html">
<meta property="og:site_name" content="玉丸子 | Blog">
<meta property="og:description" content="Skip List的工作原理 Skip List（跳跃表）是一种支持快速查找的数据结构，插入、查找和删除操作都仅仅只需要O(log n)对数级别的时间复杂度，它的效率甚至可以与红黑树等二叉平衡树相提并论，而且实现的难度要比红黑树简单多了。 Skip List主要思想是将链表与二分查找相结合，它维护了一个多层级的链表结构（用空间换取时间），可以把Skip List看作一个含有多个行的链表集合，每一行">
<meta property="og:locale">
<meta property="og:image" content="https://upload.wikimedia.org/wikipedia/commons/8/86/Skip_list.svg">
<meta property="og:image" content="https://upload.wikimedia.org/wikipedia/commons/2/2c/Skip_list_add_element-en.gif">
<meta property="article:published_time" content="2017-12-31T10:00:00.000Z">
<meta property="article:modified_time" content="2020-11-07T00:58:17.000Z">
<meta property="article:author" content="玉丸子">
<meta property="article:tag" content="2017">
<meta property="article:tag" content="Algorithms">
<meta property="article:tag" content="数据结构">
<meta name="twitter:card" content="summary">
<meta name="twitter:image" content="https://upload.wikimedia.org/wikipedia/commons/8/86/Skip_list.svg">


<link rel="canonical" href="https://suyuhuan.gitee.io/yuwanzi.io/2017/12/31/2017-12-31-skip_list/">


<script class="page-configurations">
  // https://hexo.io/docs/variables.html
  CONFIG.page = {
    sidebar: "",
    isHome : false,
    isPost : true,
    lang   : 'zh'
  };
</script>
<title>SkipList的那点事儿 | 玉丸子 | Blog</title>
  




  <noscript>
  <style>
  body { margin-top: 2rem; }

  .use-motion .menu-item,
  .use-motion .sidebar,
  .use-motion .post-block,
  .use-motion .pagination,
  .use-motion .comments,
  .use-motion .post-header,
  .use-motion .post-body,
  .use-motion .collection-header {
    visibility: visible;
  }

  .use-motion .header,
  .use-motion .site-brand-container .toggle,
  .use-motion .footer { opacity: initial; }

  .use-motion .site-title,
  .use-motion .site-subtitle,
  .use-motion .custom-logo-image {
    opacity: initial;
    top: initial;
  }

  .use-motion .logo-line {
    transform: scaleX(1);
  }

  .search-pop-overlay, .sidebar-nav { display: none; }
  .sidebar-panel { display: block; }
  </style>
</noscript>

<link rel="alternate" href="/yuwanzi.io/atom.xml" title="玉丸子 | Blog" type="application/atom+xml">
</head>

<body itemscope itemtype="http://schema.org/WebPage" class="use-motion">
  <div class="headband"></div>

  <main class="main">
    <header class="header" itemscope itemtype="http://schema.org/WPHeader">
      <div class="header-inner"><div class="site-brand-container">
  <div class="site-nav-toggle">
    <div class="toggle" aria-label="Navigationsleiste an/ausschalten" role="button">
    </div>
  </div>

  <div class="site-meta">

    <a href="/yuwanzi.io/" class="brand" rel="start">
      <i class="logo-line"></i>
      <h1 class="site-title">玉丸子 | Blog</h1>
      <i class="logo-line"></i>
    </a>
  </div>

  <div class="site-nav-right">
    <div class="toggle popup-trigger">
    </div>
  </div>
</div>







</div>
        
  
  <div class="toggle sidebar-toggle" role="button">
    <span class="toggle-line"></span>
    <span class="toggle-line"></span>
    <span class="toggle-line"></span>
  </div>

  <aside class="sidebar">

    <div class="sidebar-inner sidebar-nav-active sidebar-toc-active">
      <ul class="sidebar-nav">
        <li class="sidebar-nav-toc">
          Inhaltsverzeichnis
        </li>
        <li class="sidebar-nav-overview">
          Übersicht
        </li>
      </ul>

      <div class="sidebar-panel-container">
        <!--noindex-->
        <div class="post-toc-wrap sidebar-panel">
            <div class="post-toc animated"><ol class="nav"><li class="nav-item nav-level-3"><a class="nav-link" href="#Skip-List%E7%9A%84%E5%B7%A5%E4%BD%9C%E5%8E%9F%E7%90%86"><span class="nav-number">1.</span> <span class="nav-text">Skip List的工作原理</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#%E8%8A%82%E7%82%B9%E4%B8%8E%E5%9F%BA%E6%9C%AC%E5%AE%9E%E7%8E%B0"><span class="nav-number">2.</span> <span class="nav-text">节点与基本实现</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#%E6%9F%A5%E6%89%BE"><span class="nav-number">3.</span> <span class="nav-text">查找</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#%E6%8F%92%E5%85%A5"><span class="nav-number">4.</span> <span class="nav-text">插入</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#%E5%88%A0%E9%99%A4"><span class="nav-number">5.</span> <span class="nav-text">删除</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#%E8%BF%AD%E4%BB%A3%E5%99%A8"><span class="nav-number">6.</span> <span class="nav-text">迭代器</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#%E5%8F%82%E8%80%83%E6%96%87%E7%8C%AE"><span class="nav-number">7.</span> <span class="nav-text">参考文献</span></a></li></ol></div>
        </div>
        <!--/noindex-->

        <div class="site-overview-wrap sidebar-panel">
          <div class="site-author site-overview-item animated" itemprop="author" itemscope itemtype="http://schema.org/Person">
  <p class="site-author-name" itemprop="name">玉丸子</p>
  <div class="site-description" itemprop="description">这里是玉丸子的个人博客,与你一起发现更大的世界。</div>
</div>
<div class="site-state-wrap site-overview-item animated">
  <nav class="site-state">
      <div class="site-state-item site-state-posts">
          <a href="/yuwanzi.io/archives">
          <span class="site-state-item-count">68</span>
          <span class="site-state-item-name">Artikel</span>
        </a>
      </div>
      <div class="site-state-item site-state-categories">
            <a href="/yuwanzi.io/categories/">
        <span class="site-state-item-count">39</span>
        <span class="site-state-item-name">Kategorien</span></a>
      </div>
      <div class="site-state-item site-state-tags">
            <a href="/yuwanzi.io/tags/">
        <span class="site-state-item-count">46</span>
        <span class="site-state-item-name">schlagwörter</span></a>
      </div>
  </nav>
</div>



        </div>
      </div>
    </div>
  </aside>
  <div class="sidebar-dimmer"></div>


    </header>

    
  <div class="back-to-top" role="button">
    <i class="fa fa-arrow-up"></i>
    <span>0%</span>
  </div>

<noscript>
  <div class="noscript-warning">Theme NexT works best with JavaScript enabled</div>
</noscript>


    <div class="main-inner post posts-expand">


  


<div class="post-block">
  
  

  <article itemscope itemtype="http://schema.org/Article" class="post-content" lang="zh">
    <link itemprop="mainEntityOfPage" href="https://suyuhuan.gitee.io/yuwanzi.io/2017/12/31/2017-12-31-skip_list/">

    <span hidden itemprop="author" itemscope itemtype="http://schema.org/Person">
      <meta itemprop="image" content="/yuwanzi.io/images/avatar.gif">
      <meta itemprop="name" content="玉丸子">
      <meta itemprop="description" content="这里是玉丸子的个人博客,与你一起发现更大的世界。">
    </span>

    <span hidden itemprop="publisher" itemscope itemtype="http://schema.org/Organization">
      <meta itemprop="name" content="玉丸子 | Blog">
    </span>
      <header class="post-header">
        <h1 class="post-title" itemprop="name headline">
          SkipList的那点事儿
        </h1>

        <div class="post-meta-container">
          <div class="post-meta">
    <span class="post-meta-item">
      <span class="post-meta-item-icon">
        <i class="far fa-calendar"></i>
      </span>
      <span class="post-meta-item-text">Veröffentlicht am</span>

      <time title="Erstellt: 2017-12-31 18:00:00" itemprop="dateCreated datePublished" datetime="2017-12-31T18:00:00+08:00">2017-12-31</time>
    </span>
      <span class="post-meta-item">
        <span class="post-meta-item-icon">
          <i class="far fa-calendar-check"></i>
        </span>
        <span class="post-meta-item-text">Bearbeitet am</span>
        <time title="Geändert am: 2020-11-07 08:58:17" itemprop="dateModified" datetime="2020-11-07T08:58:17+08:00">2020-11-07</time>
      </span>
    <span class="post-meta-item">
      <span class="post-meta-item-icon">
        <i class="far fa-folder"></i>
      </span>
      <span class="post-meta-item-text">in</span>
        <span itemprop="about" itemscope itemtype="http://schema.org/Thing">
          <a href="/yuwanzi.io/categories/Algorithms/" itemprop="url" rel="index"><span itemprop="name">Algorithms</span></a>
        </span>
          . 
        <span itemprop="about" itemscope itemtype="http://schema.org/Thing">
          <a href="/yuwanzi.io/categories/Algorithms/%E6%95%B0%E6%8D%AE%E7%BB%93%E6%9E%84/" itemprop="url" rel="index"><span itemprop="name">数据结构</span></a>
        </span>
    </span>

  
</div>

        </div>
      </header>

    
    
    
    <div class="post-body" itemprop="articleBody">
        <h3 id="Skip-List的工作原理"><a href="#Skip-List的工作原理" class="headerlink" title="Skip List的工作原理"></a>Skip List的工作原理</h3><hr>
<p>Skip List（跳跃表）是一种支持快速查找的数据结构，插入、查找和删除操作都仅仅只需要<code>O(log n)</code>对数级别的时间复杂度，它的效率甚至可以与红黑树等二叉平衡树相提并论，而且实现的难度要比红黑树简单多了。</p>
<p>Skip List主要思想是将链表与二分查找相结合，它维护了一个多层级的链表结构（用空间换取时间），可以把Skip List看作一个含有多个行的链表集合，每一行就是一条链表，这样的一行链表被称为一层，每一层都是下一层的”快速通道”，即如果x层和y层都含有元素a，那么x层的a会与y层的a相互连接（垂直）。最底层的链表是含有所有节点的普通序列，而越接近顶层的链表，含有的节点则越少。</p>
<p><img src="https://upload.wikimedia.org/wikipedia/commons/8/86/Skip_list.svg"></p>
<p>对一个目标元素的搜索会从顶层链表的头部元素开始，然后遍历该链表，直到找到元素大于或等于目标元素的节点，如果当前元素正好等于目标，那么就直接返回它。如果当前元素小于目标元素，那么就垂直下降到下一层继续搜索，如果当前元素大于目标或到达链表尾部，则移动到前一个节点的位置，然后垂直下降到下一层。正因为Skip List的搜索过程会不断地从一层跳跃到下一层的，所以被称为跳跃表。</p>
<p>Skip List还有一个明显的特征，即它是一个不准确的概率性结构，这是因为Skip List在决定是否将节点冗余复制到上一层的时候（而在到达或超过顶层时，需要构建新的顶层）依赖于一个概率函数，举个栗子，我们使用一个最简单的概率函数：丢硬币，即概率<code>P</code>为<code>0.5</code>，那么依赖于该概率函数实现的Skip List会不断地”丢硬币”，如果硬币为正面就将节点复制到上一层，直到硬币为反。</p>
<p><img src="https://upload.wikimedia.org/wikipedia/commons/2/2c/Skip_list_add_element-en.gif" alt="插入元素的过程"></p>
<p>理解Skip List的原理并不困难，下面我们将使用Java来动手实现一个支持基本需求（查找，插入和删除）的Skip List。</p>
<blockquote>
<p>本文作者为<a target="_blank" rel="noopener" href="https://github.com/SylvanasSun">SylvanasSun(sylvanas.sun@gmail.com)</a>，首发于<a target="_blank" rel="noopener" href="https://sylvanassun.github.io/">SylvanasSun’s Blog</a>。<br>原文链接：<a target="_blank" rel="noopener" href="https://sylvanassun.github.io/2017/12/31/2017-12-31-skip_list/">https://sylvanassun.github.io/2017/12/31/2017-12-31-skip_list/</a><br>（转载请务必保留本段声明，并且保留超链接。）</p>
</blockquote>
<h3 id="节点与基本实现"><a href="#节点与基本实现" class="headerlink" title="节点与基本实现"></a>节点与基本实现</h3><hr>
<p>对于一个普通的链表节点一般只含有一个指向后续节点的指针（双向链表的节点含有两个指针，一个指向前节点，一个指向后节点），由于Skip List是一个多层级的链表结构，我们的设计要让节点拥有四个指针，分别对应该节点的前后左右，为了方便地将头链表永远置于顶层，还需要设置一个int属性表示该链表所处的层级。</p>
<figure class="highlight java"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br><span class="line">28</span><br><span class="line">29</span><br><span class="line">30</span><br><span class="line">31</span><br><span class="line">32</span><br><span class="line">33</span><br><span class="line">34</span><br><span class="line">35</span><br><span class="line">36</span><br><span class="line">37</span><br><span class="line">38</span><br></pre></td><td class="code"><pre><span class="line">    <span class="keyword">protected</span> <span class="keyword">static</span> <span class="class"><span class="keyword">class</span> <span class="title">Node</span>&lt;<span class="title">K</span> <span class="keyword">extends</span> <span class="title">Comparable</span>&lt;<span class="title">K</span>&gt;, <span class="title">V</span>&gt; </span>&#123;</span><br><span class="line"></span><br><span class="line">        <span class="keyword">private</span> K key;</span><br><span class="line"></span><br><span class="line">        <span class="keyword">private</span> V value;</span><br><span class="line"></span><br><span class="line">        <span class="keyword">private</span> <span class="keyword">int</span> level; <span class="comment">// 该节点所处的层级</span></span><br><span class="line"></span><br><span class="line">        <span class="keyword">private</span> Node&lt;K, V&gt; up, down, next, previous;</span><br><span class="line"></span><br><span class="line">        <span class="function"><span class="keyword">public</span> <span class="title">Node</span><span class="params">(K key, V value, <span class="keyword">int</span> level)</span> </span>&#123;</span><br><span class="line">            <span class="keyword">this</span>.key = key;</span><br><span class="line">            <span class="keyword">this</span>.value = value;</span><br><span class="line">            <span class="keyword">this</span>.level = level;</span><br><span class="line">        &#125;</span><br><span class="line"></span><br><span class="line">        <span class="meta">@Override</span></span><br><span class="line">        <span class="function"><span class="keyword">public</span> String <span class="title">toString</span><span class="params">()</span> </span>&#123;</span><br><span class="line">            StringBuilder sb = <span class="keyword">new</span> StringBuilder();</span><br><span class="line">            sb.append(<span class="string">&quot;Node[&quot;</span>)</span><br><span class="line">                    .append(<span class="string">&quot;key:&quot;</span>);</span><br><span class="line">            <span class="keyword">if</span> (<span class="keyword">this</span>.key == <span class="keyword">null</span>)</span><br><span class="line">                sb.append(<span class="string">&quot;None&quot;</span>);</span><br><span class="line">            <span class="keyword">else</span></span><br><span class="line">                sb.append(<span class="keyword">this</span>.key.toString());</span><br><span class="line"></span><br><span class="line">            sb.append(<span class="string">&quot; value:&quot;</span>);</span><br><span class="line">            <span class="keyword">if</span> (<span class="keyword">this</span>.value == <span class="keyword">null</span>)</span><br><span class="line">                sb.append(<span class="string">&quot;None&quot;</span>);</span><br><span class="line">            <span class="keyword">else</span></span><br><span class="line">                sb.append(<span class="keyword">this</span>.value.toString());</span><br><span class="line">            sb.append(<span class="string">&quot;]&quot;</span>);</span><br><span class="line">            <span class="keyword">return</span> sb.toString();</span><br><span class="line">        &#125;</span><br><span class="line">		</span><br><span class="line">		<span class="comment">// 余下都是get,set方法, 这里省略</span></span><br><span class="line">		.....</span><br><span class="line">&#125;</span><br></pre></td></tr></table></figure>
<p>接下来是SkipList的基本实现，为了能够让Key进行比较，我们规定Key的类型必须实现了Comparable接口，同时为了支持ForEach循环，该类还实现了Iterable接口。</p>
<figure class="highlight java"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br></pre></td><td class="code"><pre><span class="line"><span class="keyword">public</span> <span class="class"><span class="keyword">class</span> <span class="title">SkipList</span>&lt;<span class="title">K</span> <span class="keyword">extends</span> <span class="title">Comparable</span>&lt;<span class="title">K</span>&gt;, <span class="title">V</span>&gt; <span class="keyword">implements</span> <span class="title">Iterable</span>&lt;<span class="title">K</span>&gt; </span>&#123;</span><br><span class="line">	</span><br><span class="line">	<span class="comment">// 一个随机数生成器</span></span><br><span class="line">    <span class="keyword">protected</span> <span class="keyword">static</span> <span class="keyword">final</span> Random randomGenerator = <span class="keyword">new</span> Random();</span><br><span class="line">	</span><br><span class="line">	<span class="comment">// 默认的概率</span></span><br><span class="line">    <span class="keyword">protected</span> <span class="keyword">static</span> <span class="keyword">final</span> <span class="keyword">double</span> DEFAULT_PROBABILITY = <span class="number">0.5</span>;</span><br><span class="line">	</span><br><span class="line">	<span class="comment">// 头节点</span></span><br><span class="line">    <span class="keyword">private</span> Node&lt;K, V&gt; head;</span><br><span class="line"></span><br><span class="line">    <span class="keyword">private</span> <span class="keyword">double</span> probability;</span><br><span class="line">	</span><br><span class="line">	<span class="comment">// SkipList中的元素数量（不计算多个层级中的冗余元素）</span></span><br><span class="line">    <span class="keyword">private</span> <span class="keyword">int</span> size;</span><br><span class="line"></span><br><span class="line">    <span class="function"><span class="keyword">public</span> <span class="title">SkipList</span><span class="params">()</span> </span>&#123;</span><br><span class="line">        <span class="keyword">this</span>(DEFAULT_PROBABILITY);</span><br><span class="line">    &#125;</span><br><span class="line"></span><br><span class="line">    <span class="function"><span class="keyword">public</span> <span class="title">SkipList</span><span class="params">(<span class="keyword">double</span> probability)</span> </span>&#123;</span><br><span class="line">        <span class="keyword">this</span>.head = <span class="keyword">new</span> Node&lt;K, V&gt;(<span class="keyword">null</span>, <span class="keyword">null</span>, <span class="number">0</span>);</span><br><span class="line">        <span class="keyword">this</span>.probability = probability;</span><br><span class="line">        <span class="keyword">this</span>.size = <span class="number">0</span>;</span><br><span class="line">    &#125;</span><br><span class="line">	.....</span><br><span class="line">&#125;	</span><br></pre></td></tr></table></figure>
<p>我们还需要定义几个辅助方法，如下所示（都很简单）：</p>
<figure class="highlight java"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br><span class="line">28</span><br><span class="line">29</span><br><span class="line">30</span><br><span class="line">31</span><br></pre></td><td class="code"><pre><span class="line"><span class="comment">// 对key进行检查</span></span><br><span class="line"><span class="comment">// 因为每条链表的头节点就是一个key为null的节点，所以不允许其他节点的key也为null</span></span><br><span class="line">   <span class="function"><span class="keyword">protected</span> <span class="keyword">void</span> <span class="title">checkKeyValidity</span><span class="params">(K key)</span> </span>&#123;</span><br><span class="line">       <span class="keyword">if</span> (key == <span class="keyword">null</span>)</span><br><span class="line">           <span class="keyword">throw</span> <span class="keyword">new</span> IllegalArgumentException(<span class="string">&quot;Key must be not null!&quot;</span>);</span><br><span class="line">   &#125;</span><br><span class="line"></span><br><span class="line"><span class="comment">// a是否小于等于b</span></span><br><span class="line">   <span class="function"><span class="keyword">protected</span> <span class="keyword">boolean</span> <span class="title">lessThanOrEqual</span><span class="params">(K a, K b)</span> </span>&#123;</span><br><span class="line">       <span class="keyword">return</span> a.compareTo(b) &lt;= <span class="number">0</span>;</span><br><span class="line">   &#125;</span><br><span class="line"></span><br><span class="line"><span class="comment">// 概率函数</span></span><br><span class="line">   <span class="function"><span class="keyword">protected</span> <span class="keyword">boolean</span> <span class="title">isBuildLevel</span><span class="params">()</span> </span>&#123;</span><br><span class="line">       <span class="keyword">return</span> randomGenerator.nextDouble() &lt; probability;</span><br><span class="line">   &#125;</span><br><span class="line"></span><br><span class="line"><span class="comment">// 将y水平插入到x的后面</span></span><br><span class="line">   <span class="function"><span class="keyword">protected</span> <span class="keyword">void</span> <span class="title">horizontalInsert</span><span class="params">(Node&lt;K, V&gt; x, Node&lt;K, V&gt; y)</span> </span>&#123;</span><br><span class="line">       y.setPrevious(x);</span><br><span class="line">       y.setNext(x.getNext());</span><br><span class="line">       <span class="keyword">if</span> (x.getNext() != <span class="keyword">null</span>)</span><br><span class="line">           x.getNext().setPrevious(y);</span><br><span class="line">       x.setNext(y);</span><br><span class="line">   &#125;</span><br><span class="line"></span><br><span class="line"><span class="comment">// x与y进行垂直连接</span></span><br><span class="line">   <span class="function"><span class="keyword">protected</span> <span class="keyword">void</span> <span class="title">verticalLink</span><span class="params">(Node&lt;K, V&gt; x, Node&lt;K, V&gt; y)</span> </span>&#123;</span><br><span class="line">       x.setDown(y);</span><br><span class="line">       y.setUp(x);</span><br><span class="line">   &#125;</span><br></pre></td></tr></table></figure>
<h3 id="查找"><a href="#查找" class="headerlink" title="查找"></a>查找</h3><hr>
<p>查找一个节点的过程如下：</p>
<ul>
<li><p>从顶层链表的头部开始进行遍历，比较每一个节点的元素与目标元素的大小。</p>
</li>
<li><p>如果当前元素小于目标元素，则继续遍历。</p>
</li>
<li><p>如果当前元素等于目标元素，返回该节点。</p>
</li>
<li><p>如果当前元素大于目标元素，移动到前一个节点（必须小于等于目标元素），然后跳跃到下一层继续遍历。</p>
</li>
<li><p>如果遍历至链表尾部，跳跃到下一层继续遍历。</p>
</li>
</ul>
<figure class="highlight java"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br><span class="line">28</span><br><span class="line">29</span><br><span class="line">30</span><br><span class="line">31</span><br><span class="line">32</span><br><span class="line">33</span><br><span class="line">34</span><br><span class="line">35</span><br><span class="line">36</span><br><span class="line">37</span><br><span class="line">38</span><br></pre></td><td class="code"><pre><span class="line">  <span class="function"><span class="keyword">protected</span> Node&lt;K, V&gt; <span class="title">findNode</span><span class="params">(K key)</span> </span>&#123;</span><br><span class="line">      Node&lt;K, V&gt; node = head;</span><br><span class="line">      Node&lt;K, V&gt; next = <span class="keyword">null</span>;</span><br><span class="line">      Node&lt;K, V&gt; down = <span class="keyword">null</span>;</span><br><span class="line">      K nodeKey = <span class="keyword">null</span>;</span><br><span class="line"></span><br><span class="line">      <span class="keyword">while</span> (<span class="keyword">true</span>) &#123;</span><br><span class="line">          <span class="comment">// 不断遍历直到遇见大于目标元素的节点</span></span><br><span class="line">          next = node.getNext();</span><br><span class="line">          <span class="keyword">while</span> (next != <span class="keyword">null</span> &amp;&amp; lessThanOrEqual(next.getKey(), key)) &#123;</span><br><span class="line">              node = next;</span><br><span class="line">              next = node.getNext();</span><br><span class="line">          &#125;</span><br><span class="line">	<span class="comment">// 当前元素等于目标元素，中断循环</span></span><br><span class="line">          nodeKey = node.getKey();</span><br><span class="line">          <span class="keyword">if</span> (nodeKey != <span class="keyword">null</span> &amp;&amp; nodeKey.compareTo(key) == <span class="number">0</span>)</span><br><span class="line">              <span class="keyword">break</span>;</span><br><span class="line">          <span class="comment">// 否则，跳跃到下一层级</span></span><br><span class="line">          down = node.getDown();</span><br><span class="line">          <span class="keyword">if</span> (down != <span class="keyword">null</span>) &#123;</span><br><span class="line">              node = down;</span><br><span class="line">          &#125; <span class="keyword">else</span> &#123;</span><br><span class="line">              <span class="keyword">break</span>;</span><br><span class="line">          &#125;</span><br><span class="line">      &#125;</span><br><span class="line"></span><br><span class="line">      <span class="keyword">return</span> node;</span><br><span class="line">  &#125;</span><br><span class="line">	</span><br><span class="line">  <span class="function"><span class="keyword">public</span> V <span class="title">get</span><span class="params">(K key)</span> </span>&#123;</span><br><span class="line">      checkKeyValidity(key);</span><br><span class="line">      Node&lt;K, V&gt; node = findNode(key);</span><br><span class="line"><span class="comment">// 如果找到的节点并不等于目标元素，则目标元素不存在于SkipList中</span></span><br><span class="line">      <span class="keyword">if</span> (node.getKey().compareTo(key) == <span class="number">0</span>)</span><br><span class="line">          <span class="keyword">return</span> node.getValue();</span><br><span class="line">      <span class="keyword">else</span></span><br><span class="line">          <span class="keyword">return</span> <span class="keyword">null</span>;</span><br><span class="line">  &#125;	</span><br></pre></td></tr></table></figure>
<h3 id="插入"><a href="#插入" class="headerlink" title="插入"></a>插入</h3><hr>
<p>插入操作的过程要稍微复杂些，主要在于复制节点到上一层与构建新层的操作上。</p>
<figure class="highlight java"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br><span class="line">28</span><br><span class="line">29</span><br><span class="line">30</span><br><span class="line">31</span><br><span class="line">32</span><br><span class="line">33</span><br><span class="line">34</span><br><span class="line">35</span><br><span class="line">36</span><br><span class="line">37</span><br><span class="line">38</span><br><span class="line">39</span><br></pre></td><td class="code"><pre><span class="line">  <span class="function"><span class="keyword">public</span> <span class="keyword">void</span> <span class="title">add</span><span class="params">(K key, V value)</span> </span>&#123;</span><br><span class="line">      checkKeyValidity(key);</span><br><span class="line"><span class="comment">// 直接找到key，然后修改对应的value即可</span></span><br><span class="line">      Node&lt;K, V&gt; node = findNode(key);</span><br><span class="line">      <span class="keyword">if</span> (node.getKey() != <span class="keyword">null</span> &amp;&amp; node.getKey().compareTo(key) == <span class="number">0</span>) &#123;</span><br><span class="line">          node.setValue(value);</span><br><span class="line">          <span class="keyword">return</span>;</span><br><span class="line">      &#125;</span><br><span class="line">	</span><br><span class="line"><span class="comment">// 将newNode水平插入到node之后</span></span><br><span class="line">      Node&lt;K, V&gt; newNode = <span class="keyword">new</span> Node&lt;K, V&gt;(key, value, node.getLevel());</span><br><span class="line">      horizontalInsert(node, newNode);</span><br><span class="line">      </span><br><span class="line">      <span class="keyword">int</span> currentLevel = node.getLevel();</span><br><span class="line">      <span class="keyword">int</span> headLevel = head.getLevel();</span><br><span class="line">      <span class="keyword">while</span> (isBuildLevel()) &#123;</span><br><span class="line">          <span class="comment">// 如果当前层级已经到达或超越顶层</span></span><br><span class="line">	<span class="comment">// 那么需要构建一个新的顶层</span></span><br><span class="line">          <span class="keyword">if</span> (currentLevel &gt;= headLevel) &#123;</span><br><span class="line">              Node&lt;K, V&gt; newHead = <span class="keyword">new</span> Node&lt;K, V&gt;(<span class="keyword">null</span>, <span class="keyword">null</span>, headLevel + <span class="number">1</span>);</span><br><span class="line">              verticalLink(newHead, head);</span><br><span class="line">              head = newHead;</span><br><span class="line">              headLevel = head.getLevel();</span><br><span class="line">          &#125;</span><br><span class="line">          <span class="comment">// 找到node对应的上一层节点</span></span><br><span class="line">          <span class="keyword">while</span> (node.getUp() == <span class="keyword">null</span>) &#123;</span><br><span class="line">              node = node.getPrevious();</span><br><span class="line">          &#125;</span><br><span class="line">          node = node.getUp();</span><br><span class="line"></span><br><span class="line">	<span class="comment">// 将newNode复制到上一层</span></span><br><span class="line">          Node&lt;K, V&gt; tmp = <span class="keyword">new</span> Node&lt;K, V&gt;(key, value, node.getLevel());</span><br><span class="line">          horizontalInsert(node, tmp);</span><br><span class="line">          verticalLink(tmp, newNode);</span><br><span class="line">          newNode = tmp;</span><br><span class="line">          currentLevel++;</span><br><span class="line">      &#125;</span><br><span class="line">      size++;</span><br><span class="line">  &#125;</span><br></pre></td></tr></table></figure>

<h3 id="删除"><a href="#删除" class="headerlink" title="删除"></a>删除</h3><hr>
<p>对于删除一个节点，需要先找到节点所在的位置（位于最底层链表中的位置），之后再自底向上地删除该节点在每一行中的冗余复制。</p>
<figure class="highlight java"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br><span class="line">28</span><br></pre></td><td class="code"><pre><span class="line"><span class="function"><span class="keyword">public</span> <span class="keyword">void</span> <span class="title">remove</span><span class="params">(K key)</span> </span>&#123;</span><br><span class="line">    checkKeyValidity(key);</span><br><span class="line">    Node&lt;K, V&gt; node = findNode(key);</span><br><span class="line">    <span class="keyword">if</span> (node == <span class="keyword">null</span> || node.getKey().compareTo(key) != <span class="number">0</span>)</span><br><span class="line">        <span class="keyword">throw</span> <span class="keyword">new</span> NoSuchElementException(<span class="string">&quot;The key is not exist!&quot;</span>);</span><br><span class="line"></span><br><span class="line">    <span class="comment">// 移动到最底层</span></span><br><span class="line">    <span class="keyword">while</span> (node.getDown() != <span class="keyword">null</span>)</span><br><span class="line">        node = node.getDown();</span><br><span class="line">    <span class="comment">// 自底向上地进行删除</span></span><br><span class="line">    Node&lt;K, V&gt; prev = <span class="keyword">null</span>;</span><br><span class="line">    Node&lt;K, V&gt; next = <span class="keyword">null</span>;</span><br><span class="line">    <span class="keyword">for</span> (; node != <span class="keyword">null</span>; node = node.getUp()) &#123;</span><br><span class="line">        prev = node.getPrevious();</span><br><span class="line">        next = node.getNext();</span><br><span class="line">        <span class="keyword">if</span> (prev != <span class="keyword">null</span>)</span><br><span class="line">            prev.setNext(next);</span><br><span class="line">        <span class="keyword">if</span> (next != <span class="keyword">null</span>)</span><br><span class="line">            next.setPrevious(prev);</span><br><span class="line">    &#125;</span><br><span class="line"></span><br><span class="line">    <span class="comment">// 对顶层链表进行调整，去除无效的顶层链表</span></span><br><span class="line">    <span class="keyword">while</span> (head.getNext() == <span class="keyword">null</span> &amp;&amp; head.getDown() != <span class="keyword">null</span>) &#123;</span><br><span class="line">        head = head.getDown();</span><br><span class="line">        head.setUp(<span class="keyword">null</span>);</span><br><span class="line">    &#125;</span><br><span class="line">    size--;</span><br><span class="line">&#125;</span><br></pre></td></tr></table></figure>
<h3 id="迭代器"><a href="#迭代器" class="headerlink" title="迭代器"></a>迭代器</h3><hr>
<p>由于我们的SkipList实现了Iterable接口，所以还需要实现一个迭代器。对于迭代一个Skip List，只需要找到最底层的链表并且移动到它的首节点，然后进行遍历即可。</p>
<figure class="highlight java"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br><span class="line">28</span><br><span class="line">29</span><br><span class="line">30</span><br><span class="line">31</span><br><span class="line">32</span><br><span class="line">33</span><br><span class="line">34</span><br><span class="line">35</span><br><span class="line">36</span><br><span class="line">37</span><br><span class="line">38</span><br><span class="line">39</span><br><span class="line">40</span><br><span class="line">41</span><br><span class="line">42</span><br><span class="line">43</span><br><span class="line">44</span><br><span class="line">45</span><br><span class="line">46</span><br><span class="line">47</span><br><span class="line">48</span><br><span class="line">49</span><br><span class="line">50</span><br><span class="line">51</span><br><span class="line">52</span><br><span class="line">53</span><br><span class="line">54</span><br><span class="line">55</span><br><span class="line">56</span><br><span class="line">57</span><br><span class="line">58</span><br><span class="line">59</span><br><span class="line">60</span><br><span class="line">61</span><br><span class="line">62</span><br><span class="line">63</span><br><span class="line">64</span><br></pre></td><td class="code"><pre><span class="line">  <span class="meta">@Override</span></span><br><span class="line">  <span class="function"><span class="keyword">public</span> String <span class="title">toString</span><span class="params">()</span> </span>&#123;</span><br><span class="line">      StringBuilder sb = <span class="keyword">new</span> StringBuilder();</span><br><span class="line">      Node&lt;K, V&gt; node = head;</span><br><span class="line"></span><br><span class="line">      <span class="comment">// 移动到最底层</span></span><br><span class="line">      <span class="keyword">while</span> (node.getDown() != <span class="keyword">null</span>)</span><br><span class="line">          node = node.getDown();</span><br><span class="line"></span><br><span class="line">      <span class="keyword">while</span> (node.getPrevious() != <span class="keyword">null</span>)</span><br><span class="line">          node = node.getPrevious();</span><br><span class="line"></span><br><span class="line">      <span class="comment">// 第一个节点是头部节点，没有任何意义，所以需要移动到后一个节点</span></span><br><span class="line">      <span class="keyword">if</span> (node.getNext() != <span class="keyword">null</span>)</span><br><span class="line">          node = node.getNext();</span><br><span class="line"></span><br><span class="line"><span class="comment">// 遍历</span></span><br><span class="line">      <span class="keyword">while</span> (node != <span class="keyword">null</span>) &#123;</span><br><span class="line">          sb.append(node.toString()).append(<span class="string">&quot;\n&quot;</span>);</span><br><span class="line">          node = node.getNext();</span><br><span class="line">      &#125;</span><br><span class="line"></span><br><span class="line">      <span class="keyword">return</span> sb.toString();</span><br><span class="line">  &#125;</span><br><span class="line"></span><br><span class="line">  <span class="meta">@Override</span></span><br><span class="line">  <span class="function"><span class="keyword">public</span> Iterator&lt;K&gt; <span class="title">iterator</span><span class="params">()</span> </span>&#123;</span><br><span class="line">      <span class="keyword">return</span> <span class="keyword">new</span> SkipListIterator&lt;K, V&gt;(head);</span><br><span class="line">  &#125;</span><br><span class="line"></span><br><span class="line">  <span class="keyword">protected</span> <span class="keyword">static</span> <span class="class"><span class="keyword">class</span> <span class="title">SkipListIterator</span>&lt;<span class="title">K</span> <span class="keyword">extends</span> <span class="title">Comparable</span>&lt;<span class="title">K</span>&gt;, <span class="title">V</span>&gt; <span class="keyword">implements</span> <span class="title">Iterator</span>&lt;<span class="title">K</span>&gt; </span>&#123;</span><br><span class="line"></span><br><span class="line">      <span class="keyword">private</span> Node&lt;K, V&gt; node;</span><br><span class="line"></span><br><span class="line">      <span class="function"><span class="keyword">public</span> <span class="title">SkipListIterator</span><span class="params">(Node&lt;K, V&gt; node)</span> </span>&#123;</span><br><span class="line">          <span class="keyword">while</span> (node.getDown() != <span class="keyword">null</span>)</span><br><span class="line">              node = node.getDown();</span><br><span class="line"></span><br><span class="line">          <span class="keyword">while</span> (node.getPrevious() != <span class="keyword">null</span>)</span><br><span class="line">              node = node.getPrevious();</span><br><span class="line"></span><br><span class="line">          <span class="keyword">if</span> (node.getNext() != <span class="keyword">null</span>)</span><br><span class="line">              node = node.getNext();</span><br><span class="line"></span><br><span class="line">          <span class="keyword">this</span>.node = node;</span><br><span class="line">      &#125;</span><br><span class="line"></span><br><span class="line">      <span class="meta">@Override</span></span><br><span class="line">      <span class="function"><span class="keyword">public</span> <span class="keyword">boolean</span> <span class="title">hasNext</span><span class="params">()</span> </span>&#123;</span><br><span class="line">          <span class="keyword">return</span> <span class="keyword">this</span>.node != <span class="keyword">null</span>;</span><br><span class="line">      &#125;</span><br><span class="line"></span><br><span class="line">      <span class="meta">@Override</span></span><br><span class="line">      <span class="function"><span class="keyword">public</span> K <span class="title">next</span><span class="params">()</span> </span>&#123;</span><br><span class="line">          K result = node.getKey();</span><br><span class="line">          node = node.getNext();</span><br><span class="line">          <span class="keyword">return</span> result;</span><br><span class="line">      &#125;</span><br><span class="line"></span><br><span class="line">      <span class="meta">@Override</span></span><br><span class="line">      <span class="function"><span class="keyword">public</span> <span class="keyword">void</span> <span class="title">remove</span><span class="params">()</span> </span>&#123;</span><br><span class="line">          <span class="keyword">throw</span> <span class="keyword">new</span> UnsupportedOperationException();</span><br><span class="line">      &#125;</span><br><span class="line">  &#125;</span><br></pre></td></tr></table></figure>
<p><a target="_blank" rel="noopener" href="https://github.com/SylvanasSun/algorithms-exercise/blob/master/src/main/java/com/sylvanas/algorithms_exercise/skip_list/SkipList.java">本文中实现的SkipList完整代码地址</a></p>
<h3 id="参考文献"><a href="#参考文献" class="headerlink" title="参考文献"></a>参考文献</h3><hr>
<ul>
<li><a target="_blank" rel="noopener" href="https://en.wikipedia.org/wiki/Skip_list">Skip list - Wikipedia</a></li>
</ul>

    </div>

    
    
    

    <footer class="post-footer">
          <div class="post-tags">
              <a href="/yuwanzi.io/tags/2017/" rel="tag"># 2017</a>
              <a href="/yuwanzi.io/tags/Algorithms/" rel="tag"># Algorithms</a>
              <a href="/yuwanzi.io/tags/%E6%95%B0%E6%8D%AE%E7%BB%93%E6%9E%84/" rel="tag"># 数据结构</a>
          </div>

        

          <div class="post-nav">
            <div class="post-nav-item">
                <a href="/yuwanzi.io/2017/12/20/2017-12-20-naive_bayes/" rel="prev" title="朴素贝叶斯的那点事儿">
                  <i class="fa fa-chevron-left"></i> 朴素贝叶斯的那点事儿
                </a>
            </div>
            <div class="post-nav-item">
                <a href="/yuwanzi.io/2018/01/08/2018-01-08-spring_boot_auto_configure/" rel="next" title="Spring Boot自动配置的"魔法"是如何实现的？">
                  Spring Boot自动配置的"魔法"是如何实现的？ <i class="fa fa-chevron-right"></i>
                </a>
            </div>
          </div>
    </footer>
  </article>
</div>







<script>
  window.addEventListener('tabs:register', () => {
    let { activeClass } = CONFIG.comments;
    if (CONFIG.comments.storage) {
      activeClass = localStorage.getItem('comments_active') || activeClass;
    }
    if (activeClass) {
      const activeTab = document.querySelector(`a[href="#comment-${activeClass}"]`);
      if (activeTab) {
        activeTab.click();
      }
    }
  });
  if (CONFIG.comments.storage) {
    window.addEventListener('tabs:click', event => {
      if (!event.target.matches('.tabs-comment .tab-content .tab-pane')) return;
      const commentClass = event.target.classList[1];
      localStorage.setItem('comments_active', commentClass);
    });
  }
</script>
</div>
  </main>

  <footer class="footer">
    <div class="footer-inner">


<div class="copyright">
  &copy; 
  <span itemprop="copyrightYear">2021</span>
  <span class="with-love">
    <i class="fa fa-heart"></i>
  </span>
  <span class="author" itemprop="copyrightHolder">玉丸子</span>
</div>
  <div class="powered-by">Erstellt mit  <a href="https://hexo.io/" class="theme-link" rel="noopener" target="_blank">Hexo</a> & <a href="https://theme-next.js.org/muse/" class="theme-link" rel="noopener" target="_blank">NexT.Muse</a>
  </div>

    </div>
  </footer>

  
  <script src="//cdn.jsdelivr.net/npm/animejs@3.2.1/lib/anime.min.js"></script>
<script src="/yuwanzi.io/js/utils.js"></script><script src="/yuwanzi.io/js/motion.js"></script><script src="/yuwanzi.io/js/schemes/muse.js"></script><script src="/yuwanzi.io/js/next-boot.js"></script>

  






  





</body>
</html>
